<?php

include 'header.php';
include 'navbar.php';
include 'navbar3.php';
require_once('calendar/classes/tc_calendar.php');

if(isset($_GET['objectives']))
{

?>
<form name="form1" method="get" action="index.php">
<input type="hidden" name="objectives" value="<?php echo $_GET['objectives']; ?>" />

<div style="float: left;">
                  <?php
					
				  
						function getDaysInWeek ($weekNumber, $year, $dayStart = 1) {
						  // Count from '0104' because January 4th is always in week 1
						  // (according to ISO 8601).
						  $time = strtotime($year . '0104 +' . ($weekNumber - 1).' weeks');
						  // Get the time of the first day of the week
						  $dayTime = strtotime('-' . (date('w', $time) - $dayStart) . ' days', $time);
						  // Get the times of days 0 -> 6
						  $dayTimes = array ();
						  for ($i = 0; $i < 7; ++$i) {
							$dayTimes[] = strtotime('+' . $i . ' days', $dayTime);
						  }
						  // Return timestamps for mon-sun.
						  return $dayTimes;
						}
						$thisweek = date('W');
						$thisyear = date('Y');

						$dayTimes = getDaysInWeek($thisweek, $thisyear);
						//----------------------------------------
						
						$date1 = date('Y-m-d', strtotime('-1 month'));
						$date2 = date('Y-m-d');

	


					  $myCalendar = new tc_calendar("date3", true, false);
					  $myCalendar->setIcon("calendar/images/iconCalendar.gif");
					  $myCalendar->setDate(date('d', strtotime($date1)), date('m', strtotime($date1)), date('Y', strtotime($date1)));
					  $myCalendar->setPath("calendar/");
					  $myCalendar->setYearInterval(1970, 2020);
					  //$myCalendar->dateAllow('2009-02-20', "", false);
					  $myCalendar->setAlignment('left', 'bottom');
					  $myCalendar->setDatePair('date3', 'date4', $date2);
					  //$myCalendar->setSpecificDate(array("2011-04-01", "2011-04-04", "2011-12-25"), 0, 'year');
					  $myCalendar->writeScript();
					 
					
					  ?>
                </div>
              </div>
              <div style="float: left;">
                <div style="float: left; padding-left: 3px; padding-right: 3px; line-height: 18px;">to</div>
                <div style="float: left;">
                  <?php
					  $myCalendar = new tc_calendar("date4", true, false);
					  $myCalendar->setIcon("calendar/images/iconCalendar.gif");
					  $myCalendar->setDate(date('d', strtotime($date2)), date('m', strtotime($date2)), date('Y', strtotime($date2)));
					  $myCalendar->setPath("calendar/");
					  $myCalendar->setYearInterval(1970, 2020);
					  //$myCalendar->dateAllow("", '2009-11-03', false);
					  $myCalendar->setAlignment('left', 'bottom');
					  $myCalendar->setDatePair('date3', 'date4', $date1);
					  //$myCalendar->setSpecificDate(array("2011-04-01", "2011-04-04", "2011-12-25"), 0, 'year');
					  $myCalendar->writeScript();
					  
					  ?>
                </div>
              </div>
			  <button id="button" type="submit" class="btn btn-default">Pilih Tanggal</button>
              <!--<p>
                <input type="button" name="button2" id="button2" value="Check the value" onClick="javascript:alert('Date select from '+this.form.date3.value+' to '+this.form.date4.value);">
              </p>-->
</form>
<!--
<select name="start">
<option onclick="document.location='index.php?objectives=<?php// echo $_GET['objectives']; ?>&start=2014-10-12'">12-10-2014</option>
<option onclick="document.location='index.php?objectives=<?php //echo $_GET['objectives']; ?>&start=2014-11-12'">12-11-2014</option>
</select>
-->
<?php
}

	
/* 	if(isset($_GET['page'])) {
		$page=$_GET['page']; 
	}
		else { 
			$page="";
			include 'navbar.php';			
		} */
		
	//if(isset($_GET['profileid'])) {
		//$_SESSION['profileid'] = $_GET['profileid'];
		//include 'navbar2.php';
	//}

		
		
/* 	if($page=="true") {
		$profileid = $_SESSION['profileid'];
		echo $profileid;
		include 'navbar2.php';
		echo $page;


	} */

	if(isset($_GET['objectives'])) {
			
		$objectives=$_GET['objectives'];
		//echo $objectives;
	}
		else { 
			$objectives="";
						
		}
	if($objectives=="exposure") {
		
			
		include 'webmetrics/pageview.php';
		include 'webmetrics/toppagesrequested.php';
		include 'webmetrics/peakactivity.php';
		include 'webmetrics/Hits.php';
		include 'webmetrics/Visits.php';
		include 'webmetrics/uniquevisitor.php';
		include 'webmetrics/adimpressions.php';
		include 'webmetrics/clicks.php';
		include 'webmetrics/clickthroughrate.php';
		include 'profileaudience.php';
		include 'profileaudience2.php';
		
		
		//echo $objectives;
	}
	
	if($objectives=="stickiness") {
		include 'webmetrics/uniquevisitor.php';	
		include 'webmetrics/avgtimepervisit.php'; 
		include 'webmetrics/avgtimepervisitor.php';
		include 'webmetrics/repeatvisitorpercentage.php';
		include 'webmetrics/frequency.php';
		include 'webmetrics/recency.php';
		include 'webmetrics/stickiness.php';
		include 'profileaudience.php';		
		
		//include 'contentstickiness.php'; 
		//echo $objectives;
	}
	
		if($objectives=="usefullness") {
		include 'webmetrics/pageview.php';
		include 'webmetrics/toppagesrequested.php';
		include 'webmetrics/Visits.php';
		include 'webmetrics/uniquevisitor.php';
		include 'webmetrics/avgtimepervisit.php'; 
		include 'webmetrics/avgtimeperuniquevisitor.php';
		include 'webmetrics/repeatvisitorpercentage.php';
		include 'webmetrics/frequency.php';
		include 'webmetrics/recency.php';
		include 'webmetrics/topentrypage.php';
		include 'webmetrics/topexitpage.php';
		include 'webmetrics/pathanalysis.php';
		include 'profileaudience.php';
		
		
		
		//include 'contentusefulness.php';
		
		//echo $objectives;
	}
		if($objectives=="comarketingsuccess") {
		include 'webmetrics/clicks2.php';
		include 'profileaudience.php';		
		//include 'contentcomarketingsuccess.php'; 
		//echo $objectives;
	}
		if($objectives=="targeting") {
		include 'webmetrics/globalgeographicoverview.php';
		include 'profileaudience.php';
		include 'profileaudience2.php';
		//include 'contenttargeting.php'; 
		//echo $objectives;
	}
	




include 'footer.php';

	

	

	
	
	



 

?>